import React, { Component } from 'react';
import './List.scss';
import {index_nav} from '../utils/api'

class List extends Component {
    constructor(props){
        super(props);
        this.state={
            arr1:[]
        }
    }

    componentDidMount(){
        index_nav().then((res)=>{
            this.setState({arr1:res.data.list})
        })
    }

    render() {
        return (
            <div className='list'>
                {
                    this.state.arr1.map((item,index)=>{
                        return (
                            <div className='cate' key={index}>
                                <img src={item.pic} alt="" />
                                <span className='name'>{item.name}</span>
                            </div>
                        )
                    })
                }
                
            </div>
        );
    }
}

export default List;